import {onBeforeUnmount, onMounted} from 'vue'

export function useTitleHelper(pageTitle: string): void {
  onMounted(() => {
    if (pageTitle) {
      document.title = pageTitle + ' - ' + $f.packageInfo.productName
    } else {
      document.title = $f.packageInfo.productName
    }
  })
  onBeforeUnmount(() => {
    document.title = $f.packageInfo.productName
  })
}
